package com.example.springboot.service.impl;


import com.example.springboot.dao.TUserMapper;
import com.example.springboot.entity.TUser;
import com.example.springboot.service.ITUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lml
 * @since 2023-01-08
 */
@Service
public class TUserServiceImpl extends ServiceImpl<TUserMapper, TUser> implements ITUserService {

    @Resource
    private  TUserMapper mapper;

    @Override
    public int login(String username, String password) {
        List<TUser> tUsers = mapper.selectByName(username);
        if (tUsers.size()==0){
            return 0;
        }else {
            String password1 = tUsers.get(0).getPassword();
            if (password.equals(password1)){
                return 1;
            }else {
                return 2;
            }
        }
    }
}
